<template>
  <div class="page">
    <instructionsDetail ref="instructionsDetail" :detail="currentData"></instructionsDetail>
    <div class="scroll-view">
      <customHeader middleTitle="设备使用说明" @leftCallBack="goBack" />
      <div class="page-body">
        <mt-cell v-for="(item,index) in list" :key="index" :title="item.name" @click.native="handleLink(item)" :class="{'mt30': index==0}" is-link>
          <span slot="icon" class="icon"></span>
        </mt-cell>
      </div>
    </div>
  </div>
</template>

<script>
import customHeader from "@/components/header/header";
import jsBridge from "@/tools/jsBridge.js";
import config from "@/base/profile/config.json";
import instructionsDetail from "./instructionsDetail";

export default {
  components: {
    customHeader,
    instructionsDetail
  },
  data() {
    return {
      currentData: {},
      list: [
        {name: '按键说明', imgUrl: config.shopImgUrlPrefix+'2020/07/10/18/435121594376838.png'},
        {name: '灯效说明', imgUrl: config.shopImgUrlPrefix+'2020/08/06/13/616351596691698.png'},
        {name: '设备连接移动网络', imgUrl: config.shopImgUrlPrefix+'2020/07/10/18/333861594376895.png'},
        {name: '设备热点配置WIFI', imgUrl: config.shopImgUrlPrefix+'2020/07/10/18/706181594376927.png'},
        {name: '设备快连配置WIFI', imgUrl: config.shopImgUrlPrefix+'2020/07/10/18/535471594376964.png'},
        {name: '常见问题', imgUrl: config.shopImgUrlPrefix+'2020/07/10/18/301611594376989.png'},
      ]
    };
  },
  methods: {
    goBack() {
      if(this.$refs.instructionsDetail.popupVisible) {
        this.$refs.instructionsDetail.popupHide();
      }else if (String(this.$route.query.close)=='true') {
        jsBridge.closeWindow();
      }else {
        this.$router.back();
      }
    },
    handleLink(item) {
      this.currentData = item;
      this.$refs.instructionsDetail.popupShow();
    }
  }
}
</script>

<style lang="scss" scoped>
@import "../../../style/public";
.mt30 {
  @include remCalc(margin-top, 30);
}
.icon {
  display: inline-block;
  background: #459DFF;
  border-radius: 50%;
  @include remCalc(width, 16);
  @include remCalc(height, 16);
  @include remCalc(margin-right, 35);
}
</style>